//
//  YDHBaseScrollView.h
//  YunDaHome-iOS
//
//  Created by 刘权 on 2019/8/28.
//  Copyright © 2019 YunDa. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YDHBaseItemView.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, YDHBaseScrollViewDirection) {
    YDHBaseScrollViewDirectionHorizontal = 0,
    YDHBaseScrollViewDirectionVertical = 1  //default
};

@interface YDHBaseScrollView : UIScrollView

/// 是否允许滑动，默认为可滑动的。
@property(nonatomic, assign) BOOL canScroll;

/// view 数据源
@property(nonatomic, copy, readonly) NSArray* itemViewsArray;

/// 间距
@property (nonatomic, assign) CGFloat viewSpacing;

/// 上间距
@property (assign, nonatomic)  CGFloat  margin_top;

/// 下间距
@property (assign, nonatomic)  CGFloat  margin_bottom;

/// 左间距
@property (assign, nonatomic)  CGFloat  margin_left;

/// 右间距
@property (assign, nonatomic)  CGFloat  margin_right;

/// 方向 default:
@property (assign, nonatomic) YDHBaseScrollViewDirection direction;

/// 拼接一个视图
- (void)appendOneItemView:(UIView *)itemView;
/// 在某一位置拼接一个视图
- (void)appendOneItemView:(UIView *)itemView atIndex:(NSInteger)index;
/// 在某个视图后面的某个位置拼接个视图
- (void)appendOneItemView:(UIView *)itemView frontView:(UIView *)frontView atIndex:(NSInteger)index;

/// 删除一个子视图
- (void)removeOneItemView:(UIView *)itemView;
/// 删除某个下标的子视图
- (void)removeOnItemViewAtIndex:(NSInteger)index;
/// 删除所有
- (void)removeAllItemViews;

/// 替换一个子视图
- (void)replaceItemViewAtIndex:(NSInteger)index withItemView:(UIView*)itemView;

/// 刷新子视图frame
- (void)updateAllItemViews;

/// scrollview截长图
- (UIImage *)snapshot;

@end

NS_ASSUME_NONNULL_END
